import { defineStore } from 'pinia'
import { ref, watch } from 'vue'

export const useDataStore = defineStore('data', () => {

  const recordId = ref(window.localStorage.getItem('recordId') || '')

  const setRecordId = (val) => {
    recordId.value = val
  }

  watch(() => recordId.value,() => {
    window.localStorage.setItem('recordId', recordId.value)
  })

  return {
    recordId,
    setRecordId,
  }
})
